package com.diamond.service;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;

/**
 * @author JSmart Tools
 */
 
public interface IService<T> {

	public abstract Object findById(Serializable id) throws Exception;

	public List findByCriteria(int firstResult, int maxResults,
			DetachedCriteria criteria) throws Exception;

	public abstract Long getRowCount(String HQL) throws Exception;

	public abstract boolean deleteByParam(Serializable[] args) throws Exception;

	public abstract void save(Object entity) throws Exception;

	public abstract void update(Object entity) throws Exception;
	
	public abstract List<T> findByHQL(final int currPage, final int pagesize,final String hql);
	
	public List<T> findByHQL(final String HQL);
	
	public List<T> find(final String hql,Object[] values)throws Exception;
	
	public List<T> findBySQL(final String sql);
	
	public void updateBySQL(final String sql);
	
	public List<T> findBySqlToObj(final String SQL, final Class<T> cls);
	
	public void deleteByKey(Serializable id)throws Exception;

	public abstract Map findPage(int currPage, int pagesize, String hql);
	
	public abstract Map findCountAndPageBySql(int currPage, int pagesize,final String SQL, final Class<T> cls);
	
	public abstract Object merge(Object entity) throws Exception ;


}
